package com.management.department.teacherinfosystem.Repository;

import com.management.department.teacherinfosystem.Entity.AcademicAchievement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AcademicAchievementRepository extends JpaRepository<AcademicAchievement, Long>, JpaSpecificationExecutor<AcademicAchievement> {
    
    // 根据创建人查询
    List<AcademicAchievement> findByCreatedBy(Long createdBy);
    
    // 根据状态查询
    List<AcademicAchievement> findByStatus(String status);
    
    // 根据类型查询
    List<AcademicAchievement> findByType(String type);
    
    // 根据年份查询
    List<AcademicAchievement> findByPublicationYear(Integer year);
    
    // 根据期刊级别查询
    List<AcademicAchievement> findByJournalLevelContaining(String level);
    
    // 根据会议级别查询
    List<AcademicAchievement> findByConferenceLevelContaining(String level);
    
    // 根据关键词模糊查询
    @Query("SELECT a FROM AcademicAchievement a WHERE a.keywords LIKE %:keyword% OR a.title LIKE %:keyword%")
    List<AcademicAchievement> findByKeywordsOrTitleContaining(@Param("keyword") String keyword);
    
    // 根据期刊/会议名称查询
    List<AcademicAchievement> findByJournalConferenceContaining(String journalConference);
    
    // 根据DOI查询
    List<AcademicAchievement> findByDoiContaining(String doi);
    
    // 根据语言查询
    List<AcademicAchievement> findByLanguage(String language);
}
